package fy.erp.bean;

import java.lang.reflect.Field;

import org.json.JSONObject;

public class ProjectCostBean {

	private int index;
	private String company;
	private String companyID;
	private String projectName;
	private String Number;
	private String subject;

	private String cost;
	private String yujifeiyong;

	private String monthCost;

	private String percentage;

	private String lastMonthCost;

	private String lastLastMonthCost;

	private String balance;

	public String getBalance() {
		return balance;
	}

	public void setBalance(String balance) {
		this.balance = (balance == null || "".equals(balance) ? "0" : balance);
	}

	public String getLastMonthCost() {
		return lastMonthCost;
	}

	public void setLastMonthCost(String lastMonthCost) {
		this.lastMonthCost = (lastMonthCost == null || "".equals(lastMonthCost) ? "0"
				: lastMonthCost);
	}

	public String getLastLastMonthCost() {
		return lastLastMonthCost;
	}

	public void setLastLastMonthCost(String lastLastMonthCost) {
		this.lastLastMonthCost = (lastLastMonthCost == null
				|| "".equals(lastLastMonthCost) ? "0" : lastLastMonthCost);
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public String getPercentage() {
		return percentage;
	}

	public void setPercentage(String percentage) {
		this.percentage = percentage;
	}

	public String getMonthCost() {
		return monthCost;
	}

	public void setMonthCost(String monthCost) {
		this.monthCost = monthCost == null || "".equals(monthCost) ? "0"
				: monthCost;
	}

	public String getCompanyID() {
		return companyID;
	}

	public void setCompanyID(String companyID) {
		this.companyID = (companyID.length() == 1 ? ("0" + companyID)
				: companyID);
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public String getNumber() {
		return Number;
	}

	public void setNumber(String number) {
		Number = number;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getCost() {
		return cost;
	}

	public void setCost(String cost) {
		this.cost = (cost == null || "".equals(cost) ? "0" : cost);
	}

	public String getYujifeiyong() {
		return yujifeiyong;
	}

	public void setYujifeiyong(String yujifeiyong) {
		this.yujifeiyong = yujifeiyong;
	}

	public JSONObject toJSONObject() {

		Field[] fields = this.getClass().getDeclaredFields();
		JSONObject jo = new JSONObject();

		if (fields != null) {
			try {
				for (int i = 0, length = fields.length; i < length; i++) {
					fields[i].setAccessible(true);
					Object o = fields[i].get(this);
					fields[i].setAccessible(false);
					String name = fields[i].getName();
					jo.put(name, o);
				}
			} catch (Exception e) {
				e.printStackTrace();
			}

		}

		return jo;
	}
}
